package prdel;

import java.util.Scanner;

public class prdel {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String text = sc.nextLine();
		int mezery = 0;
		for (char neco : text.toCharArray()) {
			if (neco == ' ') {
				mezery++;
			}
		}
		String[] kousky = new String[mezery + 2];

		int x = 0;

		for (int i = 0; i <= kousky.length - 1; i++)
			kousky[i] = "";

		for (char neco : text.toCharArray()) {

			if (neco != ' ') {
				kousky[x] = kousky[x] + neco;
			}

			if (kousky[x].contains("" + text.charAt(text.length() - 1)) && zkouska(text.charAt(text.length() - 1))  ) {
				kousky[x] = kousky[x].replace(
						"" + text.charAt(text.length() - 1), "");
				kousky[x + 1] = "" + text.charAt(text.length() - 1);

			}

			if (neco == ' ') {
				x++;
			}
		}

		for (int i = kousky.length - 2; i >= 0; i--) {
			System.out.print(kousky[i] + " ");

		}
		if(zkouska(text.charAt(text.length() - 1)))
		System.out.println(text.charAt(text.length() - 1));

	}

	public static boolean zkouska(char x) {
		switch (x) {
		case '?':
		case '!':
		case ':':
			return true;

		}
		return false;
	}

}
